<?php
    require_once dirname(dirname(__FILE__)) . '/shared/config/config.php';
    require_once DOCUMENT_ROOT . DIR_ADMIN_INCLUDE . 'check_admin_login.php';
    require_once DOCUMENT_ROOT . DIR_INCLUDE . 'html_generator.php';
    require_once DOCUMENT_ROOT . DIR_SHARED_API . 'api_general.php';
    require_once DOCUMENT_ROOT . DIR_SHARED_LIBRARIES . 'lib_redirect.php';
    $title = 'Betting Commission';
    $success = NULL;
    $error = NULL;

    $txt_commission = filter_input(INPUT_POST, 'txt_commission');

    if (!empty($txt_commission)) {
        api_general::set_option('commission', $txt_commission);
        $success = "Successful!";
    }

    $commission = api_general::get_option('commission');
?>

<!DOCTYPE html>
<!--[if lt IE 7]>
<html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]>
<html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]>
<html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html class="no-js">
<!--<![endif]-->

<html>
<head>
    <?php require_once DOCUMENT_ROOT . DIR_ADMIN_INCLUDE . 'head.php' ?>
</head>
<body>
<?php require_once DOCUMENT_ROOT . DIR_ADMIN_INCLUDE . 'header.php' ?>

<!-- Title -->
<div class="section section-black">
    <div class="container">
        <div class="row">
            <div class="col-md-12">
                <div class="calltoaction-wrapper">
                    <h3>Manage Betting Commission</h3>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- End Title -->


<div class="ts-wrapper">
    <!-- Section Form -->
    <div class="section">
        <div class="container">
            <div class="row">
                <div class="col-md-offset-2 col-md-8">
                    <div class="service-wrapper">
                        <div class="text-center ts-title ts-margin-bottom">Betting Commission</div>
                        <?php show_message($success, $error, 1, 10); ?>
                        <form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST" class="form-horizontal" role="form">

                            <div class="form-group">
                                <label for="txt_name" class="col-sm-3 control-label">Commission
                                    <span class="ts-red">*</span></label>

                                <div class="col-sm-8">
                                    <div class="input-group">
                                        <input name="txt_commission" type="text" class="form-control" placeholder="
                                        <?php
                                            echo $commission;
                                        ?>
                                        ">
                                        <span class="input-group-addon">%</span>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-12">
                                    <input name="btn_save" value="Save" type="submit" class="btn btn-default">
                                </div>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- End Section Form -->
</div>

<?php require_once DOCUMENT_ROOT . DIR_ADMIN_INCLUDE . 'footer.php' ?>
</body>
</html>